<extend name="Public:common" />
<block name="main">

    <form action="{:U('build',array('navTabId'=>'Addons'))}" id="j_custom_form" url="{:U('index')}" class="form-validate  col-md-12" method="post" callback="TabAjaxDone" noEnter>
      
     
        <div class="form-row">
	 <div class="form-label col-md-2 text-right">
                    <label>标识名:</label>
                    </div>
	 <div class="form-input col-md-5">
				<input type="text" name="info[name]" value="Example">
	<div class="font-yellow mrg10T">请输入插件标识</div>
	</div>
	</div>
		 <div class="form-row">
	 <div class="form-label col-md-2 text-right"><label>插件名:</label></div>
	<div class="form-input col-md-5">
				<input type="text" name="info[title]" value="示列">
			<div class="font-yellow mrg10T">请输入插件名</div>
	</div>
	</div>
		 <div class="form-row">
	 <div class="form-label col-md-2 text-right"><label>版本:</label></div>
	<div class="form-input col-md-5">
				<input type="text" name="info[version]" value="0.1">
			<div class="font-yellow mrg10T">请输入插件版本</div>
	</div>
	</div>
		 <div class="form-row">
	 <div class="form-label col-md-2 text-right"><label>作者:</label></div>
	<div class="form-input col-md-5">
				<input type="text" name="info[author]" value="无名">
			<div class="font-yellow mrg10T">请输入插件作者</div>
	</div>
	</div>
		 <div class="form-row">
	 <div class="form-label col-md-2 text-right"><label>描述:</label></div>
	<div class="form-input col-md-5">
				
					<textarea name="info[description]" rows="4" cols="40">这是一个临时描述</textarea>
				
			<div class="font-yellow mrg10T">请输入描述</div>
	</div>
	</div>
		 <div class="form-row">
	 <div class="form-label col-md-2 text-right"><label>安装后是否启用:</label></div>
		<div class="form-input col-md-5">
				<label class="ilabel">
					<input type="checkbox"  class="j-icheck" name="info[status]" value="1" checked />
				</label>
			
		</div>
		</div>
		 <div class="form-row">
	 <div class="form-label col-md-2 text-right"><label>是否需要配置:</label></div>
			<div class="form-input col-md-5">
				<label class="ilabel"><input type="checkbox"  class="j-icheck" id="has_config" name="has_config" value="1" /></label>
				<label class="textarea has_config hidden">
					<textarea name="config" class="autosize" rows="4" cols="50">
          &lt;?php
        return array(
	    'random'=>array(//配置在表单中的键名 ,这个会是config[random]
		'title'=>'是否开启随机:',//表单的文字
		'type'=>'radio',		 //表单的类型：text、textarea、checkbox、radio、select等
		'options'=>array(		 //select 和radion、checkbox的子选项
			'1'=>'开启',		 //值=>文字
			'0'=>'关闭',
		),
		'value'=>'1',			 //表单的默认值
	),
);
					</textarea>
				</label>
				
				<input type="text" class="has_config hidden" name="custom_config">
				<div class="font-yellow mrg10T has_config hidden">自定义模板,注意：自定义模板里的表单name必须为config[name]这种，获取保存后配置的值用$data.config.name</div>
			</div>
		</div>
		 <div class="form-row">
	 <div class="form-label col-md-2 text-right"><label>是否需要外部访问:</label></div>
			<div class="form-input col-md-5">
				<input type="checkbox" class="j-icheck" name="has_outurl" value="1" />
			
		</div>
		</div>
		 <div class="form-row">
	 <div class="form-label col-md-2 text-right"><label>实现的钩子方法:</label></div>
			<div class="form-input col-md-5">
			 <div class="tags-control tagsinput " data-url="{:U('gethooks')}" data-parametername="hook[]" data-clearnotfound="true">
               <input type="text" class="tag-input autosize" value="" />
             </div>
			
			
		</div>
		</div>
		 <div class="form-row">
	 <div class="form-label col-md-2 text-right"><label>是否需要后台列表:</label></div>
			<div class="form-input col-md-5">
				<label class="ilabel">
					<input type="checkbox" class="j-icheck" id="has_adminlist" name="has_adminlist" value="1" />勾选，扩展里已装插件后台列表会出现插件名的列表菜单，如系统的附件
				</label>
				<label class="textarea has_adminlist hidden">
					<textarea name="admin_list" class="autosize" cols="50" rows="4">
            'model'=>'Example',		//要查的表
			'fields'=>'*',			//要查的字段
			'map'=>'',				//查询条件, 如果需要可以再插件类的构造方法里动态重置这个属性
			'order'=>'id desc',		//排序,
			'listKey'=>array( 		//这里定义的是除了id序号外的表格里字段显示的表头名
			'字段名'=>'表头显示名'
			),
					</textarea>
				</label>
				<input type="text" class="has_adminlist hidden" name="custom_adminlist">
				<div class="font-yellow mrg10T has_adminlist hidden">自定义模板,注意：自定义模板里的列表变量为$_list这种,遍历后可以用listkey可以控制表头显示,也可以完全手写，分页变量用$_page</div>
			
			</div>
		</div>
              
 
	 <div class="actionBar">
		<div class="form-input mrg20B text-right">
           <button type="submit" class="btn medium bg-blue">保存</button>
           <button type="button" url="{:U('index')}" class="btn-close btn medium bg-red mrg15L">取消</button>
       </div>    
		</div>
    </form>


	<script type="text/javascript">
		function bindShow(radio_bind, selectors){
			$(radio_bind).on('ifChanged',function(){
				
				$(selectors).toggleClass('hidden');
			})
		}

		//配置的动态
		bindShow('#has_config','.has_config');
		bindShow('#has_adminlist','.has_adminlist');


		
	</script>
	</block>